vt-d: Fix ioapic write order in io_apic_write_remap_rte
authorKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Aug 2010 15:32:45 +0000 (16:32 +0100)
committerKeir Fraser <keir.fraser@citrix.com>
Mon, 9 Aug 2010 15:32:45 +0000 (16:32 +0100)
At the end of io_apic_write_remap_rte, it writes new entry (remapped
interrupt) to ioapic. But it writes low 32 bits before high 32 bits,
it unmasks interrupt before writing high 32 bits if 'mask' bit in low
32 bits is cleared. Thus it may result in issues. This patch fixes
this issue by writing high 32 bits before low 32 bits.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Signed-off-by: Weidong Han <weidong.han@intel.com>
xen/drivers/passthrough/vtd/intremap.c

index 828aeb043aef19cbe0b8953227e9030d010b995f..1f9ca0e54c5ecce041626f5c597a7408a9633e36 100644 (file)
@@ -444,10 +444,10 @@ void io_apic_write_remap_rte(
     }
 
     /* write new entry to ioapic */
-    *IO_APIC_BASE(apic) = reg;
-    *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0);
     *IO_APIC_BASE(apic) = reg + 1;
     *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+1);
+    *IO_APIC_BASE(apic) = reg;
+    *(IO_APIC_BASE(apic)+4) = *(((u32 *)&old_rte)+0);
 }
 
 #if defined(__i386__) || defined(__x86_64__)